﻿using Microsoft.Owin;
using System.Threading.Tasks;
using System;

namespace Inovout.Web.Mvc.Owin
{
    public class NotifyMiddleware : OwinMiddleware
    {
        public NotifyMiddleware(OwinMiddleware next) : base(next)
        {
        }

        public override Task Invoke(IOwinContext context)
        {
            if (MessageHandlers.CanInvoke(context))
            {
                return MessageHandlers.InvokeAsync(context);
            }
            else
            {
                return Next.Invoke(context);

            }
        }
    }

}
